package com.magenta.maxoptra.gis.distancematrix;

import com.magenta.maxoptra.gis.commons.Pair;
import org.jetbrains.annotations.Nullable;

import java.util.List;
import java.util.Map;

/**
 * @author Sergey Grachev
 */
public interface RoutesIterator {

    /**
     * Check that exists any available route
     */
    boolean hasNext();

    /**
     * Get next route: from -> to
     */
    @Nullable
    Pair<DistanceMatrixCoordinate, DistanceMatrixCoordinate> nextRoute();

    /**
     * Get next routes for one direction : from -> [to1, to2, to3]
     *
     * @param limit limit for "to" array
     */
    @Nullable
    Pair<DistanceMatrixCoordinate, List<DistanceMatrixCoordinate>> nextRoutes(int limit);

    /**
     * Check that there is a route covered completely in one direction
     */
    boolean hasFinishedCoordinates();

    /**
     * Get list of completed coordinates and direction types
     */
    Map<Type, List<DistanceMatrixCoordinate>> getFinishedCoordinates();

    /**
     * Index of current route
     */
    long index();

    /**
     * Total amount of routes
     */
    long size();

    static enum Type {
        FORWARD, BACKWARD
    }
}
